package com.jysz.certificate.persistence.enums;

import com.jysz.webcore.ssh.web.convert.IEnum;

/**
 * 流程类型
 * @author xiangwei
 */
public enum PostType implements IEnum{
	   
    Admin("管理员", 0), Shop("驻店顾问", 1), Manager("区域经理", 2), Responsible("监管科", 3), RESTS("其他", 4); 
   
    //名称
    private String name;
    //索引
    private int index;   
    private PostType(String name, int index) {   
        this.name = name;   
        this.index = index;   
    }   
    
    //根据索引获得名称
    public static String getName(int index) {   
        for (PostType w : PostType.values()) {   
            if (w.getIndex() == index) {   
                return w.name;   
            }   
        }   
        return null;   
    }
    
    //根据索引获得枚举
    public static PostType index(int index) {   
    	for (PostType w : PostType.values()) {   
    		if (w.getIndex() == index) {   
    			return w;   
    		}   
    	}   
    	return null;   
    }
    //根据名字获得枚举
    public static PostType indexName(String name) {   
    	for (PostType w : PostType.values()) {   
    		if (w.getName().equals(name)) {   
    			return w;   
    		}   
    	}   
    	return null;   
    }
    
    public String getName() {   
        return name;   
    }   
    public void setName(String name) {   
        this.name = name;   
    }   
    public Integer getIndex() {   
        return index;   
    }   
    public void setIndex(int index) {   
        this.index = index;   
    }   

}
